<!DOCTYPE html>
<html lang="en">
<head>
    <title>发布问题</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <!--Import Google Icon Font-->
    <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!--Import materialize.css-->
    <!--<link type="text/css" rel="stylesheet" href="materialize/css/materialize.min.css"  media="screen,projection"/>-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/css/materialize.min.css">
    <style>
        body{
            background-color: whitesmoke;
        }
        .nav-left{
            padding-left: 82px;
        }
        nav{
            position: fixed;
            top: 0px;
            z-index: 5;
        }
        #logo{
            padding-left: 18px;
        }
        #sidenav-overlay{
            z-index: 0;
        }
    </style>
</head>
<body>
<nav>
    <div class="nav-wrapper blue">
        <a href="/toInformation" class="brand-logo" id="logo">呜呼</a>
        <a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
        <ul class="hide-on-med-and-down " style="margin-left: 82px">
            <li><a href="/toIndex">首页</a></li>
            <li><a href="#">发现</a></li>
            <li><a href="#">话题</a></li>
            <li><a href="/toWriteQuestion">提问</a></li>
        </ul>
        <ul id="nav-mobile" class="right hide-on-med-and-down">
            <li><a href="/toContact"><i class="material-icons">chat_bubble_outline</i></a></li>
            <li><a href="/toPersonalCenter"><i class="material-icons">perm_identity</i></a></li>
            <li><a href="#"><i class="material-icons">more_vert</i></a></li>
        </ul>
        <ul class="side-nav" id="mobile-demo" style="z-index: 10000">
            <li><a href="/toIndex">首页</a></li>
            <li><a href="#">发现</a></li>
            <li><a href="#">话题</a></li>
            <li><a href="/toWriteQuestion">提问</a></li>
            <li><a href="/toContact">联系人</a></li>
            <li><a href="/toPersonalCenter">个人中心</a></li>
            <li><a href="#">设置</a></li>
        </ul>
    </div>
</nav>
<div class="container" style="margin-top: 100px">
    <div class="center">
        <h4>请写下你的问题</h4>
        <h6 class="blue-grey-text">描述精确的问题更易得到解答</h6>
        <div class="">
            <div class="col s6 offset-s3 blue-grey-text">
                <input id="biaoti" style="display: block;border: white;font-size: large;text-decoration-color: black" required="" rows="2" class="Input big"
                          placeholder="问题标题">
                <div style="min-height: 78px;margin-top: 50px">
                    <div>
                        <div>
                            <div id="placeholder-fpd5k"><h5>问题背景、条件等详细信息</h5></div>
                        </div>
                        <div style="border: black 1px solid;margin-top: 20px;">
                            <input id="content" style="height: 500px;">
                        </div>
                    </div>
                </div>
                <div class="switch left" style="margin-top: 20px;">
                    <!--<label>-->
                        <!--<input type="checkbox">-->
                        <!--<span class="lever"></span>-->
                        <!--匿名-->
                    <!--</label>-->
                </div>
                <a id="submitbtn" class="waves-effect waves-light btn left" style="margin-top: 20px;margin-left: 30px">提交</a>
            </div>
        </div>
        <div class="row">
            <div class="col s6 offset-s3">

            </div>
        </div>
    </div>

</div>

<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<!--<script type="text/javascript" src="materialize/js/materialize.min.js"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.8/js/materialize.min.js"></script>
<script>
    $(document).ready(function () {
        $("#sidenav").sideNav();
        $(".button-collapse").sideNav({draggable: true});
        $("#leftnavbar").on("click",function () {
            $('.button-collapse').sideNav('hide');
        });

        $("#submitbtn").on("click",function () {
           var title = $("#biaoti").val();
           var content = $("#content").val();
           var send_data = {"title":title,"content":content};
            $.ajax({
                url : '/questions/upOne',
                type : "post",
                dataType : "json",
                data:send_data,
                async:false,
                success : function(data, textStatus, jqXHR) {
                    if ('success' == textStatus) {
                        console.log("success");
                        console.log(data);
                        // 这里要操作dom
                        // $(window).attr('location','../index');
                    }
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    alert("error");
                }
            });

            $("#sidenav").sideNav();
            $(".button-collapse").sideNav({draggable: true});
            $("#leftnavbar").on("click",function () {
                $('.button-collapse').sideNav('hide');
            });

        });

    });
</script>
</body>
</html>